﻿using System.Windows;
using System.Windows.Media.Media3D;

namespace Coding4Fun.BoxingBots.UserConsole
{
    class WPF3DModel : UIElement3D
    {
        public Point3D Position = new Point3D(0, 0, 0);

        public WPF3DModel(string resourceKey)
        {
            this.Visual3DModel = Application.Current.Resources[resourceKey] as Model3DGroup;
        }

        public double initX = 0.0;
        public double initY = 0.0;
        public double initZ = 0.0;

        public void InitialPosition(double newX, double newY, double newZ)
        {
            initX = newX;
            initY = newY;
            initZ = newZ;
            Translate(newX, newY, newZ);
        }

        public void Translate(double newX, double newY, double newZ)
        {
            Position = new Point3D(newX, newY, newZ);
            TranslateTransform3D translate3D = new TranslateTransform3D(newX, newY, newZ);
            this.Transform = translate3D;
        }

        public void EaseBack()
        {
            Position.X += (initX - Position.X) * .12;
            Position.Y += (initY - Position.Y) * .12;
            Position.Z += (initZ - Position.Z) * .12;
            TranslateTransform3D translate3D = new TranslateTransform3D(Position.X, Position.Y, Position.Z);
            this.Transform = translate3D;

        }


    }
}
